<html>
<head><meta charset="utf-8"><title>New query for traits that a type implements · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/New.20query.20for.20traits.20that.20a.20type.20implements.html">New query for traits that a type implements</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="205423817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/New%20query%20for%20traits%20that%20a%20type%20implements/near/205423817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/New.20query.20for.20traits.20that.20a.20type.20implements.html#205423817">(Jul 29 2020 at 23:02)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> heads up before I spend too much time on it - I'm going to write a query for <a href="https://github.com/rust-lang/rust/pull/74489#discussion_r461351228">https://github.com/rust-lang/rust/pull/74489#discussion_r461351228</a> so it's not so ludicrously slow</p>



<a name="205423834"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/New%20query%20for%20traits%20that%20a%20type%20implements/near/205423834" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/New.20query.20for.20traits.20that.20a.20type.20implements.html#205423834">(Jul 29 2020 at 23:02)</a>:</h4>
<p>found <a href="https://rustc-dev-guide.rust-lang.org/query.html#adding-a-new-kind-of-query">https://rustc-dev-guide.rust-lang.org/query.html#adding-a-new-kind-of-query</a> which seems about right</p>



<a name="205424198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/New%20query%20for%20traits%20that%20a%20type%20implements/near/205424198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/New.20query.20for.20traits.20that.20a.20type.20implements.html#205424198">(Jul 29 2020 at 23:09)</a>:</h4>
<p>can queries only take one input?</p>



<a name="205424280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/New%20query%20for%20traits%20that%20a%20type%20implements/near/205424280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/New.20query.20for.20traits.20that.20a.20type.20implements.html#205424280">(Jul 29 2020 at 23:10)</a>:</h4>
<p>ugh I can't even use tuples because it expects an ident and not a pattern</p>



<a name="205424285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/New%20query%20for%20traits%20that%20a%20type%20implements/near/205424285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/New.20query.20for.20traits.20that.20a.20type.20implements.html#205424285">(Jul 29 2020 at 23:10)</a>:</h4>
<p>well, let me do the simple one first</p>



<a name="205426053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/New%20query%20for%20traits%20that%20a%20type%20implements/near/205426053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/New.20query.20for.20traits.20that.20a.20type.20implements.html#205426053">(Jul 29 2020 at 23:35)</a>:</h4>
<p>wow, <code>typeck/method/probe.rs</code> is <em>complicated</em></p>



<a name="205428364"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/New%20query%20for%20traits%20that%20a%20type%20implements/near/205428364" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/New.20query.20for.20traits.20that.20a.20type.20implements.html#205428364">(Jul 30 2020 at 00:07)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> the way <code>for_each_relevant_impl</code> is set up means that I can't short-circuit if I find what I'm looking for. does it make sense to have it return <code>impl Iterator&lt;Item = DefId&gt;</code> instead of calling the callback on each id before returning?</p>



<a name="205431593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/New%20query%20for%20traits%20that%20a%20type%20implements/near/205431593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/New.20query.20for.20traits.20that.20a.20type.20implements.html#205431593">(Jul 30 2020 at 00:59)</a>:</h4>
<p>oh ugh <code>traits_in_scope</code> only works on HirIds</p>



<a name="205432986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/New%20query%20for%20traits%20that%20a%20type%20implements/near/205432986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/New.20query.20for.20traits.20that.20a.20type.20implements.html#205432986">(Jul 30 2020 at 01:31)</a>:</h4>
<p>why would <code>in_scope_traits</code> ever return <code>None</code>?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>